/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Tuan Minh
 */
public class ServiceModel extends AbstractTableModel {
    dao.Service sv = new dao.Service();
    List<entity.Service> list = sv.getAllService();
   public final static String[] columnNames = {
        "STT","Mã dịch vụ","Tên dịch vụ","Thông tin"
    };
    public int getRowCount() {
        return list.size();
    }
    public int getColumnCount() {
        return columnNames.length;
    }
    public Object getValueAt(int row, int col) {
           //Widget widget = (Widget) list.get(row);
        switch(col){
            case 0: return row+1;
            case 1: return list.get(row).getId();
            case 2: return list.get(row).getName();    
            case 3: return list.get(row).getCost();
            default: return null;  
            }
    }
 
    public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
    }  
}
